        :root {
            /* 默认暗黑主题变量 (New Palette) */
            --primary-color: #2563eb;
            --primary-hover: #598EF3;
            --secondary-color: #d946ef;
            --secondary-hover: #e16cf1; /* Manually derived */
            --success-color: #28a745;
            --danger-color: #dc3545;
            --warning-color: #ffc107;
            --info-color: #598EF3;
            --text-color: #cbd5e1;
            --text-muted: #94a3b8;
            --text-on-warning: #111;
            --bg-color: #1e293b;
            --surface-color: #334155;
            --border-color: #475569;
            --shadow-color: rgba(0, 0, 0, 0.5);
            --glass-bg: rgba(51, 65, 85, 0.75);
            --input-bg: rgba(203, 213, 225, 0.08);
            --backdrop-blur: 10px;
            --border-radius: 8px;
            --transition-speed: 0.3s;
        }

        body[data-theme="light"] {
            /* 日间主题变量 (New Palette) */
            --primary-color: #3F51B5;
            --primary-hover: #757de8;
            --secondary-color: #2196F3;
            --secondary-hover: #003f8f;
            --info-color: #2196F3;
            --text-color: #333333;
            --text-muted: #5c5c5c;
            --bg-color: #f5f5f5;
            --surface-color: #ffffff;
            --border-color: #cccccc;
            --shadow-color: rgba(0, 0, 0, 0.1);
            --glass-bg: rgba(255, 255, 255, 0.85);
            --input-bg: #ffffff;
        }

        @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&display=swap');
        * { box-sizing: border-box; }

        body {
            font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
            background-color: var(--bg-color); color: var(--text-color);
            margin: 0; padding: 0; display: flex; flex-direction: column;
            height: 100vh; overflow: hidden; transition: background-color var(--transition-speed), color var(--transition-speed);
        }

        .header {
            background: var(--glass-bg); backdrop-filter: blur(var(--backdrop-blur)); -webkit-backdrop-filter: blur(var(--backdrop-blur));
            padding: 15px 25px; border-bottom: 1px solid var(--border-color); box-shadow: 0 4px 15px var(--shadow-color);
            flex-shrink: 0; z-index: 10; transition: background-color var(--transition-speed), border-color var(--transition-speed);
        }
        .header-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 15px; }
        .title-group { display: flex; align-items: center; gap: 15px; }
        .header h1 { margin: 0; font-size: 1.6em; font-weight: 600; background: linear-gradient(45deg, var(--primary-color), var(--info-color)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
        
        #theme-toggle-btn {
            background: none; border: none; color: var(--text-muted); font-size: 1.4em; cursor: pointer;
            padding: 5px; line-height: 1; transition: color var(--transition-speed);
        }
        #theme-toggle-btn:hover { color: var(--primary-color); }
        
        #status-container { display: flex; gap: 8px; }
        .status-item { font-size: 0.85em; padding: 4px 10px; border-radius: 15px; background-color: var(--border-color);
            text-align: center; font-weight: 500; transition: all var(--transition-speed) ease; }
        #playbackIndicator { min-width: 90px; }

        .header-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
        .control-group { display: flex; align-items: center; }
        .source-group { flex-grow: 1; min-width: 300px; display: flex; }

        .select-wrapper { position: relative; display: flex; align-items: center; }
        .select-wrapper::after {
            content: '\f078'; font-family: 'Font Awesome 6 Free'; font-weight: 900;
            position: absolute; right: 15px; top: 50%; transform: translateY(-50%);
            color: var(--text-muted); pointer-events: none; transition: color var(--transition-speed);
        }
        #sourceSelector {
            -webkit-appearance: none; appearance: none;
            background-color: var(--input-bg); color: var(--text-color);
            border: 1px solid var(--border-color); border-right: none;
            border-radius: var(--border-radius) 0 0 var(--border-radius);
            padding: 10px 40px 10px 15px; font-size: 1em; width: auto; max-width: 200px;
            cursor: pointer; transition: all var(--transition-speed) ease;
        }

        #sourceUrlInput, #proxyUrlInput {
            padding: 10px 15px; border: 1px solid var(--border-color); background-color: var(--input-bg);
            color: var(--text-color); font-size: 1em; transition: all var(--transition-speed) ease;
        }
        #sourceSelector:focus, #sourceUrlInput:focus, #proxyUrlInput:focus {
            background-color: transparent; border-color: var(--primary-color);
            outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color) 25%, transparent);
        }
        #sourceUrlInput { flex-grow: 1; border-radius: 0 var(--border-radius) var(--border-radius) 0; }
        #proxyUrlInput { border-radius: var(--border-radius); }

        .btn {
    	    margin: 2px 5px;
            padding: 10px 15px; border: none; border-radius: var(--border-radius); cursor: pointer;
            font-size: 1em; font-weight: 500; color: white;
            transition: all var(--transition-speed) ease; display: flex; align-items: center; gap: 8px;
            background-color: var(--primary-color); white-space: nowrap;
        }
        .btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 4px 8px var(--shadow-color); }
        .btn:active:not(:disabled) { transform: translateY(0); box-shadow: none; }
        .btn:disabled { background-color: #555; color: #999; cursor: not-allowed; }

        #loadListBtn { background-color: var(--primary-color); }
        #playDirectBtn { background-color: var(--warning-color); color: var(--text-on-warning); }
        #loadLocalLabel { background-color: var(--success-color); }
        #saveSourceBtn { background-color: var(--secondary-color); }
        #deleteSourceBtn { background-color: var(--danger-color); }
        #localFileInput { display: none; }

        .container { display: flex; flex-grow: 1; overflow: hidden; position: relative; }
        #playlist { width: 350px; background-color: var(--surface-color); border-right: 1px solid var(--border-color);
            flex-shrink: 0; display: flex; flex-direction: column;
            transition: transform var(--transition-speed) ease, background-color var(--transition-speed), border-color var(--transition-speed); }
        #playlist-controls {
            padding: 15px; border-bottom: 1px solid var(--border-color); background: var(--glass-bg);
            backdrop-filter: blur(var(--backdrop-blur)); transition: border-color var(--transition-speed), background-color var(--transition-speed);
        }
        #search-container { display: flex; gap: 10px; margin-bottom: 15px; }
        #searchInput { width: 100%; background-color: var(--input-bg); flex-grow: 1; border-radius: var(--border-radius); border: 1px solid var(--border-color); }
        #checkAvailabilityBtn, #exportBtn { flex-shrink: 0; padding: 10px; }
        #checkAvailabilityBtn { background-color: #6f42c1; } /* Keeping this distinct purple for check action */
        #exportBtn { background-color: var(--info-color); }
        #checkAvailabilityBtn .btn-text, #exportBtn .btn-text { display: none; }
        #filter-container { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
        .filter-btn { padding: 8px 10px; font-size: 0.9em; justify-content: center; background-color: var(--border-color); color: var(--text-muted); }
        .filter-btn.active { background-color: var(--primary-color); color: white; font-weight: 600; }
        #channel-list { overflow-y: auto; flex-grow: 1; position: relative; }
        #channel-list::-webkit-scrollbar { width: 8px; }
        #channel-list::-webkit-scrollbar-track { background: var(--surface-color); }
        #channel-list::-webkit-scrollbar-thumb { background-color: #555; border-radius: 4px; border: 2px solid var(--surface-color); }
        #channel-list::-webkit-scrollbar-thumb:hover { background-color: #777; }

        .channel-item {
            display: flex; justify-content: space-between; align-items: center;
            padding: 12px 18px; cursor: pointer; border-bottom: 1px solid var(--border-color);
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.95em;
            transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease, border-color var(--transition-speed);
        }
        .channel-name { flex-grow: 1; overflow: hidden; text-overflow: ellipsis; }
        .channel-status { margin-left: 10px; font-size: 0.85em; font-weight: bold; flex-shrink: 0; padding: 2px 6px; border-radius: 4px; }
        .status-available { color: var(--success-color); }
        .status-unavailable { color: var(--danger-color); }
        .status-checking { color: var(--warning-color); }
        .channel-item:hover { background-color: var(--primary-hover); color: white; }
        .channel-item.active { background: linear-gradient(90deg, var(--primary-color), var(--primary-hover)); color: white; font-weight: 600; }
        
        .loader { width: 48px; height: 48px; border: 3px solid var(--text-color); border-bottom-color: transparent; border-radius: 50%; display: none; animation: rotation 1s linear infinite; position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%); }
        @keyframes rotation { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

        #video-container { flex-grow: 1; background-color: #000; display: flex; justify-content: center; align-items: center; }
        #videoPlayer { width: 100%; height: 100%; }
        .status-message { padding: 40px 20px; text-align: center; color: var(--text-muted); font-size: 1.1em; }
        #playlist-toggle { display: none; }

        @media (max-width: 992px) { /* Tablet and below */
            .header-controls { row-gap: 15px; }
            .proxy-group { width: 100%; order: 3; }
            #proxyUrlInput { width: 100%; }
            .management-group { order: 2; }
            .actions-group { order: 1; }
        }

        @media (max-width: 768px) { /* Mobile */
            body { overflow: auto; }
            .header { padding: 15px; }
            h1 { font-size: 1.4em !important; }
            .status-item { font-size: 0.75em; padding: 3px 8px; }
            #playbackIndicator { min-width: 75px; }
            .header-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
            .control-group, .source-group { width: 100%; }
            .source-group { grid-column: 1 / -1; }
            .actions-group, .management-group, .proxy-group { display: contents; }
            .btn span { display: none; }
            .btn { justify-content: center; padding: 12px; }
            #checkAvailabilityBtn .btn-text, #exportBtn .btn-text { display: block; }
            #checkAvailabilityBtn, #exportBtn { padding: 10px 15px; }

            .container { flex-direction: column; overflow: visible; }
            #video-container { order: 1; height: 56.25vw; min-height: 210px; width: 100%; }
            #playlist {
                position: fixed; bottom: 0; left: 0; right: 0; width: 100%; height: 60vh;
                transform: translateY(100%); border-right: none; border-top: 2px solid var(--primary-color);
                z-index: 1000; box-shadow: 0 -5px 20px var(--shadow-color);
            }
            #playlist.open { transform: translateY(0); }

            #playlist-toggle {
                display: flex; position: fixed; bottom: 60px; right: 20px;
                width: 50px; height: 50px; border-radius: 50%; background-color: var(--primary-color);
                color: white; justify-content: center; align-items: center; font-size: 1.5em;
                z-index: 1001; box-shadow: 0 4px 10px var(--shadow-color); border: none; cursor: pointer;
            }
		#sourceUrlInput {width: 1.5rem;}
        }